package domo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 98152
 * Date: 2024-06-02
 * Time: 15:03
 */
public class Test1 {
    public static void main(String[] args) {
        String str = "hello world!";
        String str1 = str.substring(3, 5);
        String str2 = str.substring(3);
        System.out.println(str1);
        System.out.println(str2);
    }
    public static void main2(String[] args) {
        String str1 = "198.192.1.2";
        String[] strings1 = str1.split("\\.");
        for (int i = 0; i < strings1.length; i++) {
            System.out.println(strings1[i]);
        }
    }
    public static void main1(String[] args) {
        String str1 = "Hello world Hello bit";
        String[] strings1 = str1.split(" ");
        for (int i = 0; i < strings1.length; i++) {
            System.out.println(strings1[i]);
        }
        System.out.println("======");
        String[] strings2 = str1.split(" ", 2);
        for (int i = 0; i < strings2.length; i++) {
            System.out.println(strings2[i]);
        }
    }
}
